const Sequelize = require("sequelize");
const sequelize = new Sequelize(
    process.env.DATA_BASE,
    process.env.DATA_BASE_USER,
    process.env.DATA_BASE_PASSWORD,
    {
        host: process.env.DATA_BASE_HOST,
        dialect: process.env.DATA_BASE_DIALECT,
        dialectModule: require(process.env.DATA_BASE_DIALECT_MOUDLE),
    }
);
sequelize
    .authenticate()
    .then(() => console.log("Connection has been established successfully."))
    .catch((error) =>
        console.error("Unable to connect to the database:", error)
    );

exports.sequelize = sequelize;
